package com.yyplatform.admin.infra.exception;

import lombok.Getter;

/**
 * Created on 2024-09-13
 */
@Getter
public class ServiceException extends RuntimeException {
    private int code;
    private String msg;

    public static ServiceException of(ErrorCode errorCode) {
        ServiceException serviceException = new ServiceException();
        serviceException.code = errorCode.getCode();
        serviceException.msg = errorCode.getMsg();
        return serviceException;
    }

    public static ServiceException of(ErrorCode errorCode, String msg) {
        ServiceException serviceException = new ServiceException();
        serviceException.code = errorCode.getCode();
        serviceException.msg = msg;
        return serviceException;
    }


}
